#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <sstream>
#include <math.h>
// #include <bits/stdc++.h>
using namespace std;

class Solution
{
public:
    void isUgly()
    {
        ios::sync_with_stdio(false);
        cin.tie(0);
        int n, m, a, temp;
        vector<int> res;
        while (cin >> n, n != 0) // 逗号运算符把几个表达式放在一起。整个逗号表达式的值为系列中最后一个表达式的值
        {
            cin >> m; // 
            a = pow(10, m);
            n = a / n;
            for (size_t i = 0; i < m; i++)
            {
                if (n % 10 != 0)
                {
                    res.push_back(n);
                    break;
                }
                n /= 10;
            }
        }
        for (size_t i = 0; i < res.size(); i++)
        {
            cout << res[i] << endl;
        }
        }
};

int main()
{
    Solution test;
    test.isUgly();
    return 0;
}